import data from './data.js'
interface OriginData {
    image_list:Array<object>,
    title:string,
    item_id:string,
    image_url:string
}
const getIamge = (data:OriginData):object[]=>{
    return data.image_list || [{url:data.image_url}]
}

const formListData = (data)=> {
    return data.map((item:OriginData)=>{
        return {
            title:item.title,
            id:item.item_id,
            image_list:getIamge(item)
        }
    })
}
export const getList = ()=>{
    return Promise.resolve(data).then(res=>{
        return formListData(res.data)
    })
}
